﻿//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//    Crolengi, this program (a part of program) is gameengine based on C++\Directx
//    Copyright (C) 2008 Pashinin Anton Alekseevich (Crol)
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
//    (INCLUDING NEGLIGENCE OR OTHERWISE) 
//    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
//    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//    Contacts: 
//    Mail: crolengi@gmail.com
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef  Effect_h
#define  Effect_h

#include "..\\import\\CRLEngi_strings_lib\\CRLEngi_strings.h"
#include "..\\import\\param_trees_lib\\param_trees.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class CLREngi_Effect{
protected:
	ID3DXEffect          *DXEffect;
	CRLEngi_string        EffectName;
	CRLEngi_string        Filename;
	CRLEngi_string        Technique;
	DynamicRow           *Parameters;

	LPDIRECT3DDEVICE9    *pd3dDevice; // Our rendering device

public:		
	bool Effect_setup(CRLEngi_string Eff_Name,CRLEngi_string Eff_FileName,DynamicRow  *row){
		Parameters = row;
		EffectName = Eff_Name;
		Filename   = Eff_FileName;

		if( FAILED(D3DXCreateEffectFromFile(*pd3dDevice,Filename.getChars(),NULL, NULL,0, NULL,&DXEffect,NULL)))
			{
				return false;
			}
		return true;
	}
	void Setup_Effect(D3DXVECTOR3 *cam_pos){
	
	}


	void Start_Effect(){

		UINT efPasses;
		DXEffect->Begin(&efPasses,NULL);
		for(UINT j = 0;j<efPasses;j++)
		{
			aEffect[m]->BeginPass(j);
	
	}
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//                                                                                                     КОНСТРУКТОР
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	CLREngi_Effect(){ 
	};

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//                                                                                                       ДЕСТРУКТОР
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	virtual ~CLREngi_Effect(){
	};
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#endif 
